#
# @lc app=leetcode.cn id=62 lang=python3
#
# [62] 不同路径
#

# @lc code=start

from typing import List

class Solution:
    
    def uniquePaths(self, m: int, n: int) -> int:
        pathsCount = [1] * n        # 这里不是m，是n
        # [1, m - 1], 有几行就计算几次
        for i in range(1, m):
            # [n-2, 0], 最后一列是1，不需要计算
            for j in reversed(range(0, n - 1)):
                pathsCount[j] = pathsCount[j+1] + pathsCount[j]
        return pathsCount[0]
# Solution().uniquePaths(1, 2)      
# @lc code=end

